const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,

      primaryKey: true,
      autoIncrement: true,
      comment: "ID",
      field: "id"
    },
    seedling_name: {
      type: DataTypes.STRING(48),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "苗种名称",
      field: "seedling_name"
    },
    seedling_scale: {
      type: DataTypes.STRING(12),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "苗种规模",
      field: "seedling_scale"
    },
    code: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "苗种编号",
      field: "code"
    },
    date_inuse: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue:  0,
      primaryKey: false,
      autoIncrement: false,
      comment: "投放日期",
      field: "date_inuse"
    },
    scale_inuse: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "投放规模",
      field: "scale_inuse"
    },
    pcode: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "所在养殖单元",
      field: "pcode"
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: "创建时间",
      field: "createdAt"
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: "更新时间",
      field: "updatedAt"
    },
    isbuy: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "购买量",
      field: "isbuy"
    },
    deletedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "deletedAt"
    }
  };
  const options = {
    tableName: "seedling_common",
    comment: "",
    indexes: [],
    timestamps: true,
    paranoid: true
  };
  const SeedlingCommonModel = sequelize.define("seedling_common_model", attributes, options);
  return SeedlingCommonModel;
};